home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / rpm / rpmps.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-10-22  |  5.3 KB  |  195 lines

  1. #ifndef H_RPMPS
  2. #define H_RPMPS
  3.  
  4. /** \ingroup rpmps
  5.  * \file lib/rpmps.h
  6.  * Structures and prototypes used for an "rpmps" problem set.
  7.  */
  8.  
  9. /*@-exportlocal@*/
  10. /*@unchecked@*/
  11. extern int _rpmps_debug;
  12. /*@=exportlocal@*/
  13.  
  14. /**
  15.  * Raw data for an element of a problem set.
  16.  */
  17. typedef /*@abstract@*/ struct rpmProblem_s * rpmProblem;
  18.  
  19. /**
  20.  * Transaction problems found while processing a transaction set/
  21.  */
  22. typedef /*@abstract@*/ /*@refcounted@*/ struct rpmps_s * rpmps;
  23.  
  24. /**
  25.  * Enumerate transaction set problem types.
  26.  */
  27. typedef enum rpmProblemType_e {
  28.     RPMPROB_BADARCH,    /*!< package ... is for a different architecture */
  29.     RPMPROB_BADOS,    /*!< package ... is for a different operating system */
  30.     RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
  31.     RPMPROB_BADRELOCATE,/*!< path ... is not relocatable for package ... */
  32.     RPMPROB_REQUIRES,    /*!< package ... has unsatisfied Requires: ... */
  33.     RPMPROB_CONFLICT,    /*!< package ... has unsatisfied Conflicts: ... */
  34.     RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
  35.     RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
  36.     RPMPROB_OLDPACKAGE,    /*!< package ... (which is newer than ...) is already installed */
  37.     RPMPROB_DISKSPACE,    /*!< installing package ... needs ... on the ... filesystem */
  38.     RPMPROB_DISKNODES,    /*!< installing package ... needs ... on the ... filesystem */
  39.     RPMPROB_BADPRETRANS    /*!< (unimplemented) */
  40.  } rpmProblemType;
  41.  
  42. /**
  43.  */
  44. struct rpmProblem_s {
  45. /*@only@*/ /*@null@*/
  46.     char * pkgNEVR;
  47. /*@only@*/ /*@null@*/
  48.     char * altNEVR;
  49. /*@exposed@*/ /*@null@*/
  50.     fnpyKey key;
  51.     rpmProblemType type;
  52.     int ignoreProblem;
  53. /*@only@*/ /*@null@*/
  54.     char * str1;
  55.     unsigned long ulong1;
  56. };
  57.  
  58. /**
  59.  */
  60. struct rpmps_s {
  61.     int numProblems;        /*!< Current probs array size. */
  62.     int numProblemsAlloced;    /*!< Allocated probs array size. */
  63.     rpmProblem probs;        /*!< Array of specific problems. */
  64. /*@refs@*/
  65.     int nrefs;            /*!< Reference count. */
  66. };
  67.  
  68. #ifdef __cplusplus
  69. extern "C" {
  70. #endif
  71.  
  72. /**
  73.  * Return formatted string representation of a problem.
  74.  * @param prob        rpm problem
  75.  * @return        formatted string (malloc'd)
  76.  */
  77. /*@-exportlocal@*/
  78. /*@-redecl@*/    /* LCL: is confused. */
  79. /*@only@*/ extern const char * rpmProblemString(const rpmProblem prob)
  80.     /*@*/;
  81. /*@=redecl@*/
  82. /*@=exportlocal@*/
  83.  
  84. /**
  85.  * Unreference a problem set instance.
  86.  * @param ps        problem set
  87.  * @param msg
  88.  * @return        problem set
  89.  */
  90. /*@unused@*/
  91. rpmps rpmpsUnlink (/*@killref@*/ /*@returned@*/ rpmps ps,
  92.         const char * msg)
  93.     /*@modifies ps @*/;
  94.  
  95. /** @todo Remove debugging entry from the ABI. */
  96. /*@-exportlocal@*/
  97. /*@null@*/
  98. rpmps XrpmpsUnlink (/*@killref@*/ /*@returned@*/ rpmps ps,
  99.         const char * msg, const char * fn, unsigned ln)
  100.     /*@modifies ps @*/;
  101. #define    rpmpsUnlink(_ps, _msg)    XrpmpsUnlink(_ps, _msg, __FILE__, __LINE__)
  102. /*@=exportlocal@*/
  103.  
  104. /**
  105.  * Reference a problem set instance.
  106.  * @param ps        transaction set
  107.  * @param msg
  108.  * @return        new transaction set reference
  109.  */
  110. /*@unused@*/
  111. rpmps rpmpsLink (rpmps ps, const char * msg)
  112.     /*@modifies ps @*/;
  113.  
  114. /** @todo Remove debugging entry from the ABI. */
  115. rpmps XrpmpsLink (rpmps ps,
  116.         const char * msg, const char * fn, unsigned ln)
  117.         /*@modifies ps @*/;
  118. #define    rpmpsLink(_ps, _msg)    XrpmpsLink(_ps, _msg, __FILE__, __LINE__)
  119.  
  120. /**
  121.  * Return number of problems in set.
  122.  * @param ps        problem set
  123.  * @return        number of problems
  124.  */
  125. int rpmpsNumProblems(/*@null@*/ rpmps ps)
  126.     /*@*/;
  127.  
  128. /**
  129.  * Create a problem set.
  130.  * @return        new problem set
  131.  */
  132. rpmps rpmpsCreate(void)
  133.     /*@*/;
  134.  
  135. /**
  136.  * Destroy a problem set.
  137.  * @param ps        problem set
  138.  * @return        NULL always
  139.  */
  140. /*@null@*/
  141. rpmps rpmpsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmps ps)
  142.     /*@modifies ps @*/;
  143.  
  144. /**
  145.  * Print problems to file handle.
  146.  * @param fp        file handle (NULL uses stderr)
  147.  * @param ps        problem set
  148.  */
  149. void rpmpsPrint(/*@null@*/ FILE *fp, /*@null@*/ rpmps ps)
  150.     /*@globals fileSystem @*/
  151.     /*@modifies *fp, ps, fileSystem @*/;
  152.  
  153. /**
  154.  * Append a problem to current set of problems.
  155.  * @param ps        problem set
  156.  * @param type        type of problem
  157.  * @param pkgNEVR    package name
  158.  * @param key        filename or python object address
  159.  * @param dn        directory name
  160.  * @param bn        file base name
  161.  * @param altNEVR    related (e.g. through a dependency) package name
  162.  * @param ulong1    generic pointer/long attribute
  163.  */
  164. void rpmpsAppend(/*@null@*/ rpmps ps, rpmProblemType type,
  165.         /*@null@*/ const char * pkgNEVR,
  166.         /*@exposed@*/ /*@null@*/ fnpyKey key,
  167.         /*@null@*/ const char * dn, /*@null@*/ const char * bn,
  168.         /*@null@*/ const char * altNEVR,
  169.         unsigned long ulong1)
  170.     /*@modifies ps @*/;
  171.  
  172. /**
  173.  * Filter a problem set.
  174.  *
  175.  * As the problem sets are generated in an order solely dependent
  176.  * on the ordering of the packages in the transaction, and that
  177.  * ordering can't be changed, the problem sets must be parallel to
  178.  * one another. Additionally, the filter set must be a subset of the
  179.  * target set, given the operations available on transaction set.
  180.  * This is good, as it lets us perform this trim in linear time, rather
  181.  * then logarithmic or quadratic.
  182.  *
  183.  * @param ps        problem set
  184.  * @param filter    problem filter (or NULL)
  185.  * @return        0 no problems, 1 if problems remain
  186.  */
  187. int rpmpsTrim(/*@null@*/ rpmps ps, /*@null@*/ rpmps filter)
  188.     /*@modifies ps @*/;
  189.  
  190. #ifdef __cplusplus
  191. }
  192. #endif
  193.  
  194. #endif    /* H_RPMPS */
  195.